#include <iostream>
#include <cstring>
using namespace std;

struct bei{
    string name ;//杯子名字
    int rongliang;//杯子容量
    int val;//杯子价格
    char caizhi[20];//杯子材质
    void init(int r,string name){
        this->rongliang = r;
        this->name = name;
    }
    void show(){
        cout << "装了" << rongliang << "的水"<< endl;
    }
    void show_all();
};

int main(){

    bei beizi1;
    
    //第一个对象
    beizi1.rongliang=100;
    strcpy(beizi1.caizhi,"玻璃");
    beizi1.init(10,"小容量");
    beizi1.show();
    beizi1.show_all();

    //第二个对象
    bei beizi2;
    beizi2.rongliang=200;
    strcpy(beizi2.caizhi,"304钢");
    beizi2.init(199,"中等容量");
    beizi2.show();
    beizi2.show_all();

    //第三个对象
    bei *beizi3 = new bei;
    strcpy(beizi3->caizhi,"钛合金");
    beizi3->rongliang = 1000;
    beizi3->init(999,"超大容量");
    beizi3->show_all();
    beizi3->show();

    return 0;
}
void bei::show_all(){
    cout<<"杯子的名字是："<<this->name<<
    " 杯子的价格是："<<this->val<<
    " 杯子的容量是："<<this->rongliang<<
    " 杯子的材质是："<< this->caizhi<<endl;
}